<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="renderer" content="webkit"> 
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> 
<meta name="format-detection" content="telephone=no" /> 
<link rel="shortcut icon" href="images/logo.ico" />
<title>闪度生活</title>
<meta name="keywords" content=" " />
<meta name="description" content=" " />


<link rel="stylesheet" type="text/css" href="css/common.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="css/font-awesome.css">
<link rel="stylesheet" type="text/css" href="css/swiper-3.4.1.min.css">
<link rel="stylesheet" type="text/css" href="css/style.css">

<script src="js/jquery-1.11.1.min.js"></script>
<script src="js/bootstrap.js"></script>
<script src="js/jquery-ui.min.js"></script>
<script src="js/easing.js"></script>
<script src="js/swiper-3.4.1.min.js"></script>
<script src="js/index.js"></script>
<script src="js/main.js"></script>

<script src="./js/vue.js"></script>
<script src="./js/axios.min.js"></script>
<script src="./js/axios-config.js"></script>
<script src="./js/js.cookie.js"></script>
<script src="./js/utils.js"></script>

</head>


<body class="body_bg2">

<div id="app" v-cloak>
<!--  / header  -->
<div class="header_longevity">
        <div class="header_map_longevity">   
            <img src="images/jiantou.png" alt="">
            <span>返回</span>
        </div>
        <div class="logo_longevity">我的优惠券</div>
        <div class="header_shop_longevity">使用说明</div>   
</div>
<!--  / header  -->


<div class="myCoupon">
    <div class="myCoupon1">
        <span class="coupon_active" @click="getcoupon(1)">未使用</span>
        <span @click="getcoupon(2)">已过期</span>
        <span @click="getcoupon(3)">已使用</span>
    </div>
    <div class="myCoupon3 clearfix" v-for="coupon in coupon_list" @click="goOrderSure(coupon)">
        <div class="myCoupon3-left">
            <img src="images/myCoupon_1.jpg" alt="" width="100%">
        </div>
        <div class="myCoupon3-right">
            <div class="myCoupon3-right1">{{coupon.name}}</div>
            <div class="myCoupon3-right2">{{coupon.condition}}</div>
            <div class="myCoupon3-right3">截止时间：</div>
            <div class="myCoupon3-right4">{{coupon.useendtime}}</div>
        </div>
    </div>


</div>
</div>

</body>
<script>
var url = location.href;
isToken(url);

$(window).ready(function(){

var vm = new Vue({
		el:"#app",
		data() {
	    return {
	        userId: (() => {
	                
	            })(),
	        coupon_list:''
	    }
		},
    created: function () {
		var $this = this;
    	$this.getcoupon();
        
    },
    mounted:function(){
    	
    },
    methods:{
    	
    	//我的优惠券
    	getcoupon:function(type){
    		var $this = this;
    		
    		const data = {
    			type:1
    		}
    		if(type != ''){
    			data.type = type;
    		}
    		Axios.post(window.Url.coupon, data).then((res) => {
    			
    			// tt(res.result,'http://shandu.unohacha.com/wx_shandu/myCoupon.html');
                if(res.result == -1 || res.result == '-1'){
                    sq('http://shandu.unohacha.com/wx_shandu/myCoupon.html');
                }
                if(res.result == 1){
                    $this.coupon_list=[];
    				$this.coupon_list = res.info.coupon;
    				
    			}else if(res.result == 0){
                    $this.coupon_list=[];
                    console.log('我的优惠券'+res.info)
                }
    			
            }).catch((err) => {
              console.log('我的优惠券'+err)
            })
        
    	},


        goOrderSure:function(coupons){
            sessionStorage.setItem('coupons', JSON.stringify(coupons));
            window.location.href="order_sure.html";
        }
	}
})


$('.banner').height($(window).width()*400/750);

var mySwiper_banner = new Swiper ('.swiper-container-banner', {
    loop: true,
    pagination: '.swiper-pagination-banner',
	autoplay : 5000,
	autoplayDisableOnInteraction : false,
})
$('.header_map_longevity').click(function(){
    if(sessionStorage.getItem("what1") && sessionStorage.getItem("what1")==1){
        window.location.href = "order_sure.html";
    }else{
        window.location.href = "user.html";
    }    
});
$('.longevity1 li').click(function(){
    window.location.href = "InformationDetails.html";
});
$(".remain").click(function(){
    window.location.href = "remain.html";
})
$(".coupon").click(function(){
    window.location.href = "myCoupon.html";
})
$(".myCoupon1 span").click(function(){
    $(this).addClass("coupon_active");
    $(this).siblings().removeClass("coupon_active");
})
$('.header_shop_longevity').click(function(){
     window.location.href = "coupon-use.html";
})

  
})  
</script>
</html>
